package cn.jinjimi.app.main.uicontroller;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.MediaController;

/**
 * Created by Roy
 * Date: 15/11/27
 */
public class MyMediaController extends MediaController {

    public interface ShowStateChangeListener {
        void onShown();

        void onHidden();
    }

    private ShowStateChangeListener listener;

    public void setShowStateChangeListener(ShowStateChangeListener listener) {
        this.listener = listener;
    }

    public MyMediaController(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public MyMediaController(Context context, boolean useFastForward) {
        super(context, useFastForward);
    }

    public MyMediaController(Context context) {
        super(context);
    }

    @Override
    public void show(int timeout) {
        super.show(timeout);
        if (listener != null) {
            listener.onShown();
        }
    }

    @Override
    public void hide() {
        super.hide();
        if (listener != null) {
            listener.onHidden();
        }
    }
}
